#ifndef __MONITORING_MODULE_H__
#define __MONITORING_MODULE_H__

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include "lib.h"

#define POS_SYSCALL_OPEN  5
#define POS_SYSCALL_WRITE 4
#define POS_SYSCALL_LSEEK 19
#define POS_SYSCALL_CLOSE 6
#define POS_SYSCALL_CLONE 120

// Nou thread info que guarda les estadístiques
struct my_thread_info {
	struct thread_info info;
	struct statistics stats[NR_CALLS];
	int pid;
};


// Funcions relatives a les estadístiques i la monitoritzacio
void reset_all_statistics(void);
void reset_process_statistics(struct statistics *stats);
int enable_monitoring(int call);
int disable_monitoring(int call);
void print_stats(void);


// Taula de crides a sistema
extern void *sys_call_table[];

// Buffers on es guarden les adreces a crides de sistema
void *default_sys_calls[NR_CALLS];
void *monitor_sys_calls[NR_CALLS];
int call_positions[NR_CALLS] = {5, 4, 19, 6, 120};

// Funcions que monitoritzen les respectives crides a sistema
long sys_open_monitor(const char __user * filename, int flags, int mode);
long sys_close_monitor(unsigned int fd);
ssize_t sys_write_monitor(unsigned int fd, const char __user * buf, size_t count);
off_t sys_lseek_monitor(unsigned int fd, off_t offset, unsigned int origin);
int sys_clone_monitor(struct pt_regs regs);

#endif
